<?php

namespace app\model;
use think\Db;

class AdminPassport extends PassportCommon
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'admin_passport';
    }

    /**
     * 类入口
     * @return AdminPassport
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }

    /**
     * @param $arr_where
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function toLimit($arr_where)
    {
        return Db::name($this->db_name)->where($arr_where)->field('gmt_create AS gmtCreate')->order('gmt_create desc')->limit(0, 1)->select();
    }
}
